import * as THREE from "three";
/**基础方法模板 */
export function distance(visible:Boolean) {
    let domContainer = document.getElementById("threeContainer");
    // 使用visible判断当前是选中还是释放状态
    if (visible) {
        domContainer.style.cursor = "crosshair";
        domContainer?.addEventListener("mousemove", onPointerMove);
    }
    else{
        domContainer.style.cursor = "default";
        console.log(domContainer,'domContainer');
        domContainer?.removeEventListener("mousemove",onPointerMove);
    }
}
// onPointerMove需要放在导出的函数外，否则取消监听会不生效
function onPointerMove(event: any) {
    const pointer = new THREE.Vector2();
    console.log(event, 'event');
    pointer.x = (event.clientX / window.innerWidth) * 2 - 1;
    pointer.y = -(event.clientY / window.innerHeight) * 2 + 1;
}